In [3]:
%matplotlib inline
In [7]:
import matplotlib.pyplot as plt
import numpy as np
In [6]:
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
In [8]:
def graph(formula, x_range):
x = np.array(x_range)
y = eval(formula)
plt.plot(x, y)
plt.show()
In [36]:
graph('4569+143*x', range(0, 20))
In [24]:
def valueInMonth(x):
intercept = 4569
slope = 143
return intercept + slope * x
In [25]:
valueInMonth(10)
Out[25]:
In [26]:
valueInMonth(52)
Out[26]:
In [28]:
def housePriceRegression(x):
intercept = -44850
slope = 280.76
return intercept + x * slope
In [33]:
280.76 / 0.092903 # Something is wrong
Out[33]:
In [37]:
280.76 * 10
Out[37]:
In [38]:
3022.076789769975 * 0.9290304
Out[38]:
In [ ]: